Skip to content

Resolve the product variant once at startup - #5131

Merged
caseydavenport merged 11 commits into
tigera:masterfrom
caseydavenport:casey-variant-resolution
Aug 4, 2026
Merged

Resolve the product variant once at startup#5131
caseydavenport merged 11 commits into
tigera:masterfrom
caseydavenport:casey-variant-resolution

Conversation

@caseydavenport

@caseydavenport caseydavenport commented Jul 31, 2026

Copy link
Copy Markdown
Member

The operator decides which variant it is running in four places: the --variant flag, Enterprise CRD discovery, the Installation spec, and the Installation status. The one gating most controllers is CRD discovery, which is not what the user set and stays true after a downgrade because the CRDs outlive the variant change.

This resolves the variant once from the Installation before any controller starts, and restarts the operator from a single watch when it changes. Design: https://github.com/tigera/designs/pull/89 (CORE-13240).

Description

  • the variant is resolved in main from the Installation, merging the overlay, and passed to controllers as one option
  • restart-on-variant-change moves to a watch on the manager cache; the reboot in the installation controller goes away, along with its ability to fire mid-uninstall
  • the bootstrap ConfigMap watch moves onto the manager cache too, which drops a goroutine that could never be stopped
  • registration gates key on the variant rather than on whether the Enterprise CRDs exist
  • GetInstallationSpec no longer returns the status variant, so controllers cannot re-derive it
  • the --variant flag is now bootstrap-only and validated; an unrecognised value used to be treated as Calico, which installs the wrong CRDs for the bootstrap-crds path where nothing runs afterwards to correct them
  • updateCRDs installs CRDs for the overlay-merged variant. It read the spec variant before the overlay was merged in, so an overlay that set the variant got the wrong CRD set.
  • fillDefaults defaults to the process variant instead of hardcoding Calico, so it and main cannot disagree

Behaviour changes worth calling out:

  • an Enterprise install whose Installation omits the variant now comes up as Enterprise. Previously fillDefaults overrode it to Calico.
  • asking for Enterprise without the Enterprise CRDs now fails at startup with a message rather than degrading on every reconcile.

Also fixes a latent ImageSet bug. During an Enterprise install the status variant lags the spec, so controllers asked for a calico- ImageSet. GetImageSet only errors when an ImageSet with the matching prefix exists, so on a cluster carrying only enterprise-<version> it found nothing, returned no error, and the components deployed with built-in image tags. Air-gapped clusters fail to pull; everyone else silently gets floating tags instead of the digests they pinned.

Fixes an issue where components could be deployed with default image tags instead of the images from a configured ImageSet during a Calico Enterprise installation.

The operator runs as a single variant for the lifetime of the process, and
restarts when the Installation asks for a different one.
Reuses the informer the controllers already have for Installation instead of
opening a second watch with a hand-built REST client.
Drops the hand-rolled client-go informer and its unstoppable goroutine. The
shared cache isn't filtered, so the handler matches on name and namespace.
The installation controller no longer reboots the operator; the variant watch
handles that. Missing Enterprise CRDs now fail at startup with a message rather
than degrading on every reconcile.
It reports whether the cluster serves the Calico Enterprise APIs, which is no
longer the same question as whether to start those controllers.
Controller registration and reconcile decisions use the variant the process
booted as. GetInstallationSpec no longer returns the status variant, the
enterprise-CRD-exists option is gone, and fillDefaults defaults to the process
variant so main and the installation controller agree.
EnterpriseCRDsExist meant the enterprise CRDs were present, not that the
operator ran as Enterprise. The mainline and pool suites install Calico.
Comment thread cmd/main.go Outdated
Comment thread cmd/main.go Outdated
updateCRDs read the spec variant before the overlay was merged in, so an
overlay that set the variant would get the wrong CRD set.
The bootstrap flag now only ever selects which CRDs to install. Splits the
non-blocking lookup out so the variant watch shares it.
Comment thread pkg/controller/csr/csr_controller.go Outdated
Comment thread pkg/controller/gatewayapi/gatewayapi_controller.go
Comment thread cmd/main.go Outdated
Comment thread cmd/main.go Outdated
Comment thread cmd/main.go
Pass the variant to the CSR controller like every other controller does,
rather than a bool.
staticcheck flags TigeraSecureEnterprise, and the test just needs an
enterprise variant.
@caseydavenport
caseydavenport merged commit 989cbc0 into tigera:master Aug 4, 2026
6 checks passed
@caseydavenport
caseydavenport deleted the casey-variant-resolution branch August 4, 2026 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants